<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en" class="no-js" id="ng-app">
<head>
<meta charset="UTF-8">
<jsp:include page="/includes/common/head.jsp" />
<title>CS4280 BOOKSTORE</title>
</head>
<body>
	<div data-flex-background-src="${ baseURL }/assets/img/background.jpg"
		flex-background></div>
	<jsp:include page="/includes/header.jsp">
		<jsp:param name="currentUser" value="${currentUser}" /><jsp:param name="baseURL" value="${ baseURL }" />
	</jsp:include>
	<section id="mainContent">
		<c:if test="${action!=null && action=='refund' }">
		Refund request of Invoice (ID: ${request_invoice.id}) has been sent successfully! 
	</c:if>

		<c:if test="${action!=null && action=='cancel' }">
		Refund request of Invoice (ID: ${request_invoice.id}) has been cancelled successfully! 
	</c:if>
		<section id="content">
			<table class="shush-table">
				<tr class="table_header">
					<td>TRANSACTION ID</td>
					<td>BOOK NAME</td>
					<td>DATE</td>
					<td>REQUEST</td>
				</tr>
				<c:forEach var="invoice" items="${invoiceList}"
					varStatus="invoiceIndex">
					<tr>
						<td>${invoice.id}</td>
						<td>${bookList[invoiceIndex.index].title}</td>
						<td>${invoice.date}</td>

						<td><c:if
								test="${invoice.refund == false && invoice.isRefunded == false && invoice.loyaltyPointUsed == false}">
								<form
									action="${ baseURL }/member/purchase?action=refund&id=${ invoice.id }"
									method="post">
									<input type="submit" name="refund" value="REFUND">
								</form>
							</c:if> <c:if test="${invoice.refund == true}">
								<form
									action="${ baseURL }/member/purchase?action=cancel&id=${ invoice.id }"
									method="post">
									<input type="submit" name="refund" value="CANCEL REQUEST">
								</form>
							</c:if> <c:if test="${invoice.isRefunded == true}">
						REFUNDED
					</c:if> <c:if test="${invoice.loyaltyPointUsed == true}">
						NON-REFUNDABLE
					</c:if></td>
					</tr>
				</c:forEach>
			</table>
		</section>
	</section>
</body>
</html>
